﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace Serialize.model
{
    [DataContract(Name = "user", Namespace = "https://heima.codeplex.com/")]
    public class User
    {
        public User()
        {
            Console.WriteLine("User构造函数");
            Console.ReadKey(true);
        }

        public User(string userName, string password)
        {
            this.ID = Guid.NewGuid();
            this.UserName = userName;
            this.Password = password;
        }

        [DataMember(Name = "id", Order = 1)]
        public Guid ID { get; set; }

        [DataMember(Name = "userName", Order = 2)]
        public string UserName { get; set; }

        [DataMember(Name = "password", Order = 3)]
        public string Password { get; set; }

        public override string ToString()
        {
            return string.Format("用户ID：{0}\r\n用户名：{1}\r\n密码：{2}", ID, UserName, Password);
        }
    }
}
